/***************************************************************************
 *   Copyright (C) 2007 by gaojian   *
 *   781102@vip.sina.com   *
 *   你若要喜爱你自己的价值，你就得给世界创造价值。 —— 歌德                                                                      *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef VOCABULARYLIST_H
#define VOCABULARYLIST_H

#include <klistview.h>
#include <kio/job.h>
#include <dom/dom_doc.h>

class QBuffer;
class QStringList;
class QListViewItem;
class QPopupMenu;
class QProcess;
/**
	@author gaojian <781102@vip.sina.com>
*/
class VocabularyList : public KListView
{
 Q_OBJECT
public:
    VocabularyList(QWidget * parent = 0, const char *name = 0);

    ~VocabularyList();
    
    
protected:

    // ListView IDs
    int lv_num;//addColumn的返回值
    int lv_title;//addColumn的返回值
    QBuffer *buffer;//kio的缓冲区
    DOM::Document doc;
    DOM::NodeList wordlist;//节点列表
    QStringList stringlist;
protected slots:
    void slotData(KIO::Job *job, const QByteArray &data);
    void slotResult(KIO::Job *job);
    void slotPopupMenu(QListViewItem * item,const QPoint &point);
    void Refresh();//接受右键菜单的刷新命令
    void slotGoWebVocabulary();
protected:
    void fetchVocabulary();//从网站抓取生词
    void addWord();//把生词添加到列表中
private:
   QPopupMenu *popup;
   QProcess *proc;
};

#endif
